var basePath = '/taotao-web';

function save(id){
	if(id == null || id ==''){
		url = basePath+'/user/add.do';
	}else{
		url = basePath+'/user/update.do';
	}
	//var para = $('#userForm').serializeObject();  
	var para = getFormData('userForm');
	console.log(para);
	$.ajax({
		  type: "POST",
		  url: url,
		  dataType: "json",
		  data:{"str":JSON.stringify(para)},
		  success:function(data){
			  $.messager.show({
                  title: '提示',
                  msg: data.msg,
                  showType: 'show',
              });
			  if(data.code = '1000'){
				  $('#userInfo').window('close'); 
				  $("#userList").datagrid("reload");
				  $("#userList").datagrid("clearSelections");
			  }else{
				  $.messager.alert('提示','失败!');
			  }
		  }
		}); 
}

//重置
function clearForm(){
	$('#userForm').form('clear');
}

//展开
function showSubTest(index) {
	$('#userList').datagrid('expandRow', index);
	$('#showSub_' + index).css("display", "none");
	$('#hiddenSub_' + index).css("display", "block");
}

//收起
function hiddenSubTest(index) {
	$('#userList').datagrid('collapseRow', index);
	$('#showSub_' + index).css("display", "block");
	$('#hiddenSub_' + index).css("display", "none");
}